﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/admin.master" CodeBehind="Accounts.aspx.cs"
    Inherits="LiveWebServiceAdmin.Domains" %>

<asp:Content ContentPlaceHolderID="MenuContent" ID="PageType" runat="server">
    <p>
        3</p>
</asp:Content>
<asp:Content ContentPlaceHolderID="TopContent" ID="PageInfo" runat="server">
    Accounts
    <br />
    <br />
    Your administrative accounts:
</asp:Content>
<asp:Content ContentPlaceHolderID="TopBannerContent" ID="PageAbout" runat="server">
    Edit administrator's accounts.
</asp:Content>
<asp:Content ContentPlaceHolderID="BottomBannerContent" ID="Content1" runat="server">
    Add new administration accounts here.
</asp:Content>
<asp:Content ContentPlaceHolderID="BottomContent" ID="PageMain" runat="server">
    <div id="manageduser">
        <asp:HiddenField ID="hdManagedUser" runat="server" />
    </div>
    <div id="currentorganization">
        <asp:HiddenField ID="hdOrganization" runat="server" />
    </div>
    <div id="currentsite">
        <asp:HiddenField ID="hdSiteid" runat="server" />
    </div>
    <div id="currentaccount">
        <asp:HiddenField ID="hdAccount" runat="server" />
    </div>
    <table id="accounts" width="100%">
        <tr align="center">
            <td colspan="4">
                <asp:ListBox ID="lbUserSiteIDs" runat="server" Height="250px" Width="100%" SelectionMode="Single"
                    OnSelectedIndexChanged="lbUserSiteIDs_SelectedIndexChanged"></asp:ListBox>
            </td>
        </tr>
        <tr align="center">
            <td>
                <a id="newac" href="javascript:void(0)" title="Create new Accounts" class="thickbox">
                    Add Accounts</a>
            </td>
            <td>
                <div id="viewac">
                    <a href="javascript:void(0)">View Domains</a>
                </div>
            </td>
            <td>
                <div id="editac">
                    <a href="javascript:void(0)" title="Edit Accounts" class="thickbox">Edit Accounts</a>
                </div>
            </td>
            <td>
                <div id="deleteac">
                    <%--<a href="javascript:void(0)" title="Delete Accounts" class="thickbox">Delete Accounts</a>--%>
                    <asp:Button ID="btnDeleteOrg" CssClass="buttonlink" runat="server" Text="Delete Accounts"
                        OnClick="btnDeleteOrg_Click" />
                </div>
            </td>
        </tr>
    </table>
    <div>

        <script language="javascript" type="text/javascript">
            $(document).ready(function() {
                var manageuser = $("#manageduser").find("input").get(0).value;
                var manageorg = $("#currentorganization").find("input").get(0).value;
                var mangesite = $("#currentsite").find("input").get(0).value;

                $("#newac").attr("href", "/ActionPages/manageaccounts.aspx?manageuser=" + manageuser + "&manageorganization=" + manageorg + "&managesite=" + mangesite + "&edit&keepThis=true&TB_iframe=true&height=200&width=600");

                $("#viewac").hide();
                $("#viewac").find("a").attr("href", "javascript:void(0)");

                $("#editac").hide();
                $("#editac").find("a").attr("href", "javascript:void(0)");

                $("#deleteac").hide();
                $("#deleteac").find("a").attr("href", "javascript:void(0)");
            });

            $("#accounts").find("select").click(function(event) {
                var options = $("#accounts").find("option").each(function(index) {
                    if ($(this).attr("selected")) {
                        var manageuser = $("#manageduser").find("input").get(0).value;
                        var manageorg = $("#currentorganization").find("input").get(0).value;
                        var mangesite = $("#currentsite").find("input").get(0).value;
                        var editac = $(this).get(0).value;

                        $("#viewac").show();
                        $("#viewac").find("a").attr("href", "/domains.aspx?manageuser=" + manageuser + "&manageorganization=" + manageorg + "&managesite=" + mangesite + "&manageaccounts=" + editac);

                        $("#editac").show();
                        $("#editac").find("a").attr("href", "/ActionPages/manageaccounts.aspx?manageuser=" + manageuser + "&manageorganization=" + manageorg + "&managesite=" + mangesite + "&editeac=" + editac + "&keepThis=true&TB_iframe=true&height=200&width=500");

                        $("#deleteac").show();
//                        $("#deleteac").find("a").attr("href", "/ActionPages/manageaccounts.aspx?manageuser=" + manageuser + "&manageorganization=" + manageorg + "&managesite=" + mangesite + "&deleteac=" + editac + "&keepThis=true&TB_iframe=true&height=200&width=500");
                    }
                }
                );
            });
        </script>

    </div>
</asp:Content>
